package ar.com.gep.soccer.services.dto;

import java.util.List;

import com.google.gson.annotations.Expose;

import ar.com.cdt.framework.business.dto.BaseDTO;

public class GameDTO extends BaseDTO {

	private static final long serialVersionUID = 1510594092299566290L;

	private Boolean state;

	@Expose	
	private TeamDTO home;

	@Expose	
	private TeamDTO away;

	@Expose	
	private Integer goalHome;

	@Expose
	private Integer goalAway;

	public Boolean getState() {
		return state;
	}

	public void setState(Boolean state) {
		this.state = state;
	}

	public TeamDTO getHome() {
		return home;
	}

	public void setHome(TeamDTO home) {
		this.home = home;
	}

	public TeamDTO getAway() {
		return away;
	}

	public void setAway(TeamDTO away) {
		this.away = away;
	}

	public Integer getGoalHome() {
		return goalHome;
	}

	public void setGoalHome(Integer goalHome) {
		this.goalHome = goalHome;
	}

	public Integer getGoalAway() {
		return goalAway;
	}

	public void setGoalAway(Integer goalAway) {
		this.goalAway = goalAway;
	}

	public List<Integer> getHomeSkills() {
		return getHome().getListSkills();
	}

	public List<Integer> getAwaySkill() {
		return getAway().getListSkills();
	}

	/**
	 * Devuelve si hay ganador
	 * 
	 * @return
	 */
	public boolean hasWinner() {
		return !getGoalAway().equals(getGoalHome());
	}

	public TeamDTO getWinner() {
		TeamDTO team;
		if (getGoalHome() > getGoalAway()) {
			team = getHome();
		} else {
			team = getAway();
		}
		return team;
	}

	public TeamDTO getLoser() {
		TeamDTO team;
		if (getGoalHome() < getGoalAway()) {
			team = getHome();
		} else {
			team = getAway();
		}
		return team;
	}

}
